package com.chanzany.iterator.case1;

import java.util.List;

public class OutPutImpl {
	//学院集合
	private final List<College> collegeList;

	public OutPutImpl(List<College> collegeList) {
		this.collegeList = collegeList;
	}
	//遍历所有学院,然后调用printDepartment 输出各个学院的系
	public void printCollege() {
		for (College college : collegeList) {
			System.out.println("------------"+college.getName()+"----------------");
			printDepartment(college.iterator());
		}
	}

	//输出 学院输出 系
	public void printDepartment(Iterator<Department> iterator) {
		while(iterator.hasNext()) {
			Department d = iterator.next();
			System.out.println(d.getName());
		}
	}
}